﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site2.Master" Inherits="System.Web.Mvc.ViewPage<DTO.Models.MEDIA>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	GetForm
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <script type="text/javascript">
        function loadEditor(id) {
            
        }
    </script>
    <% Html.EnableClientValidation(); %> 
    <% using(Html.BeginForm("GetForm", "Media", FormMethod.Post, new {id="frmMedia",enctype = "multipart/form-data"})){%>
        <div class="dung-section frm-insert">
		<div class="dung-section-title"><%= ViewData["status"] %> <%= ConfigurationManager.AppSettings[ViewData["TypeMediaName"].ToString()] %></div>
		<div class="dung-section-content">
        <%= Html.ValidationSummary() %>
			<div class="frm-control">
				<div class="dung-right">
					<input type="submit" name="submit" class="dung-button" value="Lưu" />
                    <%--<%= Html.ActionLink("Bỏ qua", "MediaList", "Media", new { id = Model.TypeMediaName }, new {@class="dung-button" })%>--%>
                    <input type="button" class="dung-button" value="Bỏ qua" onclick="boqua()" />
				</div>
				<div class="clearer">&nbsp;</div>
			</div>
			<div>
				<ul class="dung-tab-list">
					<li id="tab-info" class="selected"><a>Thông tin chính</a></li>
					<li id="tab-detail"><a>Chi tiết</a></li>
				</ul>
				<div class="clearer">&nbsp;</div>
					
				<div id="fragment-info" class="media dung-round">	
					<div class="dung-col2 dung-left">
					    <p>
                            <%= Html.HiddenFor(model => model.ID) %>
                            <%= Html.HiddenFor(model => model.MediaID) %>
                            <%= Html.CheckBox("IsDelete", Model.IsDelete.Value, new { @style = "display:none" })%>
                            <%= Html.HiddenFor(model => model.TypeMediaName) %>
                            <%= Html.Hidden("UserCreate", Model.UserCreate) %>
                            <%= Html.TextAreaFor(model => model.DateCreate, new { @style = "display:none" })%>
				        </p>
					    <p>
					        <label><b><%= Html.LabelFor(model => model.Title) %></b></label>
					        <br/>
                            <%= Html.TextBoxFor(model => model.Title, new {@class="dung-textbox", size="50", maxlength="200"})%>
				        </p>

					    <p>
					        <label><b><%= Html.LabelFor(model => model.Intro) %></b></label>
						    <br/>
                            <%= Html.TextAreaFor(model => model.Intro, new {@class="dung-textbox", cols="100", rows="5"})%>
					    </p>
                        <p>
                            <label><b><%= Html.LabelFor(model => model.IsPublish)%></b></label>
                            <br/>
                            <%= Html.CheckBox("IsPublish", Model.IsPublish) %>
                        </p>
                        <p>
                            <label><b><%= Html.LabelFor(model => model.IsTop) %></b></label>
                            <br/>
                            <%= Html.CheckBox("IsTop", Model.IsTop) %>
                        </p>
				    </div>
				    <div class="dung-col2 dung-right dung-text-right">
					    <p style="">
						    <input type="button" class="dung-button" value="Chọn hình" onclick="showuploadimage()" />
					    </p>
					    <p>
                            <% if (Model.ID != 0)
                               {%>
					            <img class="image-main" src="<%= Url.Content("~/MediaImage/" + Model.ID.ToString() + ".jpg") %>" width="150px" height="150px" alt="no-image" />
                            <%}
                               else
                               {%>
                               <img class="image-main" src="<%= Url.Content("~/image/no_image.gif") %>" width="150px" height="150px" alt="no-image" />
                            <%} %>
					        <br/>	
				        </p>
                        <p id="selectimage" style="display:none">
                            <input id="file" type="file" name="file" />
                            <br/>
                            <input type="button" class="dung-button" value="Bỏ chọn" onclick="unselectimage()" />
                        </p>
				    </div>
					<div class="clearer">&nbsp;</div>
				</div>
				
				<div id="fragment-detail" class="media dung-round" style="display:none">
				    <%= Html.TextAreaFor(model => model.Content, new {@class="dung-textbox editor"})%>
                    <script type="text/javascript">
                        CKEDITOR.replace('Content', { height: "700", width: "99%", htmlEncodeOutput: true });
			        </script>
			        
				</div>
				
			</div>
		</div>
	</div>

    <% } %>

    <script type="text/javascript">

        function boqua() {
            window.location = "/Media/MediaList/" + "<%=Model.TypeMediaName %>";
        }
        function showuploadimage() {
            $("#selectimage").toggle('slow');
        }

        function unselectimage() {
            $("#file").val("");
            $("#selectimage").toggle('slow');
        }

        

    </script>

</asp:Content>

